package com.huawei.hms.support.api.hwid;

import android.app.Activity;
import android.content.Intent;
import com.huawei.hms.support.api.ResolveResult;
import com.huawei.hms.support.api.client.ResultCallback;
import com.huawei.hms.support.api.entity.core.JosGetNoticeResp;
import com.huawei.hms.support.log.HMSLog;
import com.huawei.hms.utils.Util;

class HuaweiIdApiImpl$a implements ResultCallback<ResolveResult<JosGetNoticeResp>> {
    final /* synthetic */ HuaweiIdApiImpl a;

    private HuaweiIdApiImpl$a(HuaweiIdApiImpl huaweiIdApiImpl) {
        this.a = huaweiIdApiImpl;
    }

    public /* synthetic */ void onResult(Object obj) {
        a((ResolveResult) obj);
    }

    public void a(ResolveResult<JosGetNoticeResp> resolveResult) {
        if (resolveResult != null && resolveResult.getStatus().isSuccess()) {
            JosGetNoticeResp josGetNoticeResp = (JosGetNoticeResp) resolveResult.getValue();
            Intent noticeIntent = josGetNoticeResp.getNoticeIntent();
            if (noticeIntent != null && josGetNoticeResp.getStatusCode() == 0) {
                HMSLog.d("HuaweiIdApiImpl", "get notice has intent.");
                Activity validActivity = Util.getValidActivity((Activity) HuaweiIdApiImpl.b(this.a).get(), HuaweiIdApiImpl.a(this.a).getTopActivity());
                if (validActivity == null) {
                    HMSLog.e("HuaweiIdApiImpl", "showNotice no valid activity!");
                } else {
                    validActivity.startActivity(noticeIntent);
                }
            }
        }
    }
}
